package com.example.hospitalsystem.controller;


import com.example.hospitalsystem.result.Result;
import com.example.hospitalsystem.service.LikesService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/like")
@Tag(name="16.点赞模块")
public class LikesController {

    @Autowired
    private LikesService likesService;

    @Operation(summary = "用户点赞",security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/likesAdd/{designId}")
    public Result addLikesFun(@PathVariable("designId") Integer designId){
        return likesService.addLike(designId);
    }

    @Operation(summary = "用户取消点赞",security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/likesCancel/{designId}")
    public Result cancelLikesFun(@PathVariable("designId") Integer designId){
        return likesService.cancelLike(designId);
    }

    @Operation(summary = "获取点赞状态",security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/likesState/{designId}")
    public Result likeStateFun(@PathVariable("designId") Integer designId){
        return likesService.likeSate(designId);
    }

    @Operation(summary = "获取所有点赞信息",security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/getAllLike")
    public Result getAllLike(){
        return likesService.getAllLikeInfo();
    }

}
